﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Batch_Disc_Backup
{
    /// <summary>
    /// Stores the information for the DiscCopier process. This information is also
    /// saved as a json file for logging (see the Log static class).
    /// </summary>
    [DataContract]
    public class DiscCopyInfo
    {
        [DataMember]
        public string FromDir { get; set; }
        [DataMember]
        public string ToDir { get; set; }
        [DataMember]
        public string DriveLetter { get; set; }
        [DataMember]
        public long TotalBytesCopied { get; set; }
        [DataMember]
        public long TotalFilesLength { get; set; }
        [DataMember]
        public string VolumeLabel { get; set; }
        [DataMember]
        public List<FileToCopy> FilesToCopy { get; set; }
        public long FileCount { get { return FilesToCopy.Count; } }
        [DataMember]
        public DateTime? DateStarted { get; set; }
        [DataMember]
        public DateTime? DateEnded { get; set; }
        [DataMember]
        public int ExceptionCount { get; set; }

        public string LogFilename { get; set; }

        public DiscCopyInfo()
        {
        }

        public DiscCopyInfo(string driveLetter, string fromDir, string toDir)
        {
            this.FromDir = fromDir;
            this.ToDir = toDir;
            this.DriveLetter = driveLetter;
            this.TotalBytesCopied = 0;
            this.TotalFilesLength = 0;
            this.VolumeLabel = null;
            this.FilesToCopy = new List<FileToCopy>();
            this.DateStarted = null;
            this.DateEnded = null;
            this.LogFilename = null;
            this.ExceptionCount = 0;
        }
    }
}
